package www.wen.com.common.lib.initializer

import android.content.Context
import androidx.startup.Initializer
import www.wen.com.common.lib.extension.glide.ImageLoader

/**
 * @author WEN
 * @Description:
 * @date 2020/11/30 3:02
 */
class ImageLoaderInitializer : Initializer<Unit> {

    override fun create(context: Context) {
        ImageLoader.getDefault().diskCacheOptions()
            .setDiskCacheDirPath(context.getExternalFilesDir("Cache")?.path ?: context.filesDir.path)
            .setDiskCacheFolderName("Image")
            .setDiskCacheSize(2 * 1024 * 1024) // 设置磁盘缓存2G
            .setBitmapPoolSize(2.0f)
            .setMemoryCacheSize(1.5f)
            .build()
    }

    override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()

}

